# Maintainer: Alex Xu (Hello71) <alex_y_xu@yahoo.ca>
pkgname=highway
pkgver=0.17.0
pkgrel=0
pkgdesc="Performance-portable, length-agnostic SIMD with runtime dispatch"
url="https://github.com/google/highway"
arch="all"
license="Apache-2.0"
makedepends="cmake gtest-dev samurai"
subpackages="$pkgname-dev"
source="https://github.com/google/highway/archive/$pkgver/highway-$pkgver.tar.gz"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DBUILD_TESTING=ON \
		-DHWY_SYSTEM_GTEST=ON
	cmake --build build
}

check() {
	cd build
	[ -n "$CTEST_PARALLEL_LEVEL" ] || export CTEST_PARALLEL_LEVEL="$JOBS"
	case "$CARCH" in
		s390x) skipped_tests="(HwyDemoteTest\.TestAllReorderDemote2To|HwyMulTest\.TestAllReorderWidenMulAccumulate|DotTest\.TestAllDotBF16)" ;;
		aarch64) skipped_tests="(HwyMaskTest\.TestAllAllTrueFalse)" ;;
	esac
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest ${skipped_tests+-E "$skipped_tests"}
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
7e55724c844a09a07cb981a7d8e913dcc5491e07d14ff3e7783a69060b0c470e7d5adc4f5dbeea526b3e109eea8cc9e80605d6b8d2da1b794382e56fd534ba06  highway-0.17.0.tar.gz
"
